from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
#权限
from  django.contrib.auth.models import Permission,ContentType,Group

from meiduo_admin.serializers.permision_serilazer import PermissionSerializer, ContentTypeSerializer
from meiduo_admin.utils import PageNum

class PermissionViewSet(ModelViewSet):
    queryset = Permission.objects.all().order_by('id')
    pagination_class = PageNum
    serializer_class = PermissionSerializer


    def content_type(self, request):
        data = ContentType.objects.all().order_by('id')
        ser = ContentTypeSerializer(data, many=True)
        return Response(ser.data)